{namespace vh=In2code\Powermail\ViewHelpers}
<f:layout name="Export" />

Render Powermail XLS Export
{mails}					All Mails for exporting
{fields}				Fields to export (drag'n drop settings in module)

<f:section name="main"><html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8">
	</head>
	<body>
		<table>
			<f:for each="{mails}" as="mail" iteration="index">
				<f:if condition="{index.isFirst}">
					<tr>
						<f:for each="{fields}" as="field">
							<th>
								{field.title}
							</th>
						</f:for>
					</tr>
				</f:if>


				<tr>
					<f:for each="{fields}" as="field">
						<td>
							<f:for each="{mail.answers}" as="answer">
								<f:if condition="{field} == {answer.field}">
									<f:if condition="{vh:Condition.IsArray(val: '{answer.value}')}">
										<f:then>
											<f:for each="{answer.value}" as="singleValue">
												<f:if condition="{singleValue}">
													{singleValue},
												</f:if>
											</f:for>
										</f:then>
										<f:else>
											{answer.value}
										</f:else>
									</f:if>
								</f:if>
							</f:for>
						</td>
					</f:for>
				</tr>
			</f:for>
		</table>
	</body>
</html>

</f:section>